#ifndef FINDVIGENEREKEYLENGHT_H
#define FINDVIGENEREKEYLENGHT_H

#include <QThread>

class FindVigenereKeyLenght : public QThread
{
    Q_OBJECT
public:
    FindVigenereKeyLenght(QByteArray input, QByteArray alphabet, int maxLenght, QObject *parent = 0);
    FindVigenereKeyLenght(QByteArray input, QByteArray alphabet, QList<qreal> langFreqs, bool trustFriedman = false, QObject *parent = 0);

protected:
    void run();
    
signals:
    void done (int keyLenght);
    void done (QList<int> correlations);
    
public slots:

private:
    QByteArray input;
    QByteArray alphabet;
    int maxLenght;
    QList<qreal> langFreqs;
    bool useFriedman;
    bool trustFriedman;

    int commonByteArraySubString(QByteArray b1, QByteArray b2);
    
};

#endif // FINDVIGENEREKEYLENGHT_H
